﻿using SqlSugar;
using System.Collections.Generic;

namespace QingZhouLinYe_Web.Models
{
    [SugarTable("FangHuoDanWei")]
    public class FangHuoDanWei
    {
        [SugarColumn(IsIdentity = true, IsPrimaryKey = true, ColumnDescription = "主键Id")]
        public int Id { get; set; }

        [SugarColumn(ColumnDescription = "所属区划ID")]
        public int QuHuaId { get; set; }

        [SugarColumn(ColumnDataType = "varchar(50)", ColumnDescription = "防火单位名称")]
        public string MingCheng { get; set; }

        [SugarColumn(ColumnDescription = "中心位置", IsNullable = true, ColumnDataType = "geometry", SqlParameterDbType =typeof(LocationConverter))]
        public Location CenterShape { get;set; }

        [SugarColumn(ColumnDescription ="边界", IsNullable = true,ColumnDataType ="geometry", SqlParameterDbType = typeof(PolygonConverter))]
        public Polygon BorderShape { get; set; }

        [SugarColumn(ColumnDescription = "比例尺精度", IsNullable = true)]
        public int MapLevel { get; set; }

        [SugarColumn(IsIgnore = true)]     //CodeFist数据库时不映射字段
        [Navigate(NavigateType.ManyToOne,nameof(QuHuaId))]  //配置多对一关系，定义多个防火单位属于一个区划
        public QuHua QuHua { get; set; }

        [SugarColumn(IsIgnore = true)]    //CodeFist数据库时不映射字段
        [Navigate(NavigateType.OneToMany, nameof(SheBei.FangHuoDanWeiId))]   //配置一对多关系，定义一个防火单位有多台设备
        public List<SheBei> SheBeis { get; set; }

        [SugarColumn(IsIgnore = true)]    //CodeFist数据库时不映射字段
        [Navigate(NavigateType.OneToMany,nameof(Models.UserInfo.FangHuoDanWeiId))]   //配置一对多关系，定义一个防火单位有多个用户
        public List<UserInfo> UserInfos { get; set; }

        [SugarColumn(IsIgnore = true)]    //CodeFist数据库时不映射字段
        [Navigate(NavigateType.OneToMany, nameof(HuoQing.FangHuoDanWeiId))]   //配置一对多关系，定义一个防火单位有多个火情
        public List<HuoQing> HuoQings { get; set; }
    }
}